#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
学生信息管理系统数据初始化脚本
用于创建包含基础数据的students.txt文件
"""

from student_management_system import StudentManagementSystem, Student

def init_sample_data():
    """初始化示例数据"""
    print("正在初始化学生信息数据...")
    
    # 创建系统实例
    system = StudentManagementSystem("students.txt")
    
    # 清空现有数据
    system.students.clear()
    
    # 添加示例学生数据
    sample_students = [
        Student("2024001", "张三", 20, "计算机科学与技术", "计科2024-1"),
        Student("2024002", "李四", 19, "软件工程", "软工2024-1"),
        Student("2024003", "王五", 21, "计算机科学与技术", "计科2024-2"),
        Student("2024004", "赵六", 20, "数据科学与大数据技术", "数据2024-1"),
        Student("2024005", "钱七", 22, "网络工程", "网工2024-1"),
        Student("2024006", "孙八", 19, "人工智能", "智能2024-1"),
        Student("2024007", "周九", 21, "软件工程", "软工2024-2"),
        Student("2024008", "吴十", 20, "计算机科学与技术", "计科2024-3"),
        Student("2024009", "郑十一", 21, "信息安全", "信安2024-1"),
        Student("2024010", "王十二", 19, "物联网工程", "物联网2024-1"),
        Student("2024011", "李十三", 22, "数据科学与大数据技术", "数据2024-2"),
        Student("2024012", "张十四", 20, "人工智能", "智能2024-2"),
        Student("2024013", "刘十五", 21, "软件工程", "软工2024-3"),
        Student("2024014", "陈十六", 19, "计算机科学与技术", "计科2024-4"),
        Student("2024015", "杨十七", 20, "网络工程", "网工2024-2")
    ]
    
    # 添加学生到系统
    for student in sample_students:
        system.students.append(student)
    
    # 保存数据
    system.save_data()
    
    print(f"成功初始化 {len(sample_students)} 名学生的数据！")
    print("\n学生信息预览：")
    print("-" * 80)
    for i, student in enumerate(system.students, 1):
        print(f"{i:2d}. {student}")
    
    print(f"\n数据已保存到文件: {system.data_file}")
    print("现在可以运行 python3 student_management_system.py 来使用系统了！")

if __name__ == "__main__":
    init_sample_data()
